package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchPumpGroupOperationData;
import com.ruoyi.system.service.IDispatchPumpGroupOperationDataService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 泵组运行数据Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchPumpGroupOperationData")
public class DispatchPumpGroupOperationDataController extends BaseController
{
    @Autowired
    private IDispatchPumpGroupOperationDataService dispatchPumpGroupOperationDataService;

    /**
     * 查询泵组运行数据列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPumpGroupOperationData:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchPumpGroupOperationData dispatchPumpGroupOperationData)
    {
        startPage();
        List<DispatchPumpGroupOperationData> list = dispatchPumpGroupOperationDataService.selectDispatchPumpGroupOperationDataList(dispatchPumpGroupOperationData);
        return getDataTable(list);
    }

    /**
     * 导出泵组运行数据列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPumpGroupOperationData:export')")
    @Log(title = "泵组运行数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchPumpGroupOperationData dispatchPumpGroupOperationData)
    {
        List<DispatchPumpGroupOperationData> list = dispatchPumpGroupOperationDataService.selectDispatchPumpGroupOperationDataList(dispatchPumpGroupOperationData);
        ExcelUtil<DispatchPumpGroupOperationData> util = new ExcelUtil<DispatchPumpGroupOperationData>(DispatchPumpGroupOperationData.class);
        util.exportExcel(response, list, "泵组运行数据数据");
    }

    /**
     * 获取泵组运行数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPumpGroupOperationData:query')")
    @GetMapping(value = "/{pumpGroupOperationDataId}")
    public AjaxResult getInfo(@PathVariable("pumpGroupOperationDataId") Long pumpGroupOperationDataId)
    {
        return success(dispatchPumpGroupOperationDataService.selectDispatchPumpGroupOperationDataByPumpGroupOperationDataId(pumpGroupOperationDataId));
    }

    /**
     * 新增泵组运行数据
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPumpGroupOperationData:add')")
    @Log(title = "泵组运行数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchPumpGroupOperationData dispatchPumpGroupOperationData)
    {
        return toAjax(dispatchPumpGroupOperationDataService.insertDispatchPumpGroupOperationData(dispatchPumpGroupOperationData));
    }

    /**
     * 修改泵组运行数据
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPumpGroupOperationData:edit')")
    @Log(title = "泵组运行数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchPumpGroupOperationData dispatchPumpGroupOperationData)
    {
        return toAjax(dispatchPumpGroupOperationDataService.updateDispatchPumpGroupOperationData(dispatchPumpGroupOperationData));
    }

    /**
     * 删除泵组运行数据
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchPumpGroupOperationData:remove')")
    @Log(title = "泵组运行数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{pumpGroupOperationDataIds}")
    public AjaxResult remove(@PathVariable Long[] pumpGroupOperationDataIds)
    {
        return toAjax(dispatchPumpGroupOperationDataService.deleteDispatchPumpGroupOperationDataByPumpGroupOperationDataIds(pumpGroupOperationDataIds));
    }
}
